package com.fzdy.product.entity;

import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "t_user")
@Data
public class User {
    @Id
    @Column(name = "id")
    private Integer id;
    @Column(name = "name")
    private String name;
    @Column(name = "password")
    private String password;
    @Basic
    @Column(name = "role_id")
    private Integer roleId;
    @Column(name = "create_date")
    private Date createDate;

    @ManyToOne
    @JoinColumn(name = "role_id", referencedColumnName = "id",foreignKey = @ForeignKey(name = "user_ibfk_1"),
            insertable = false, updatable = false)
    private Role role;

    public User() {
    }

    public User(String name) {
        this.name = name;
    }
}